package net.yxsoft.controller.pc.sysmgt.common.validator;

import com.jfinal.core.Controller;
import com.jfinal.validate.Validator;
import net.yxsoft.model.infrastructure.TsUser;
import rapid.core.ContextStateEnum;
import rapid.core.TResult;

/**
 * Created by Administrator on 2016/6/28.
 */

public class UserValidator extends Validator {
  /**
  * @MethodName: validate
  * @Description:
  * @param: c
  * @return void
  * @throws
  * @date 2023/8/31 15:36
  * @author jhf
  */
   protected void validate(Controller c) {

     setShortCircuit(true);

     validateRequired("NAME", "title_Valid", "名称不能为空。");
     validateRequired("LOGIN_ID", "title_Valid", "账号不能为空。");
   }
   /**
   * @MethodName: handleError
   * @Description:
   * @param: c
   * @return void
   * @throws
   * @date 2023/8/31 15:36
   * @author jhf
   */
  protected void handleError(Controller c) {
    TResult _result = new TResult();
    c.keepPara(TsUser.class);
    _result.setState(ContextStateEnum.FAIL);
    _result.setMessage(c.getAttr("title_Valid").toString());
    c.renderJson(_result);
  }

}